﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Tasks;

namespace WJP.DataPortal.Helper
{
    internal class CompactMessageEncoderFactory : MessageEncoderFactory
    {
        /// <summary>Stores the compact message encoder</summary>
        private readonly CompactMessageEncoder _encoder;

        /// <summary>
        /// Stores the message encoder factory of the inner encoder
        /// </summary>
        private readonly MessageEncoderFactory _innerFactory;

        /// <summary>Construct a compact message encoder factory</summary>
        /// <param name="innerFactory">The inner encoder factory</param>
        /// o
        public CompactMessageEncoderFactory(MessageEncoderFactory innerFactory)
        {
            this._innerFactory = innerFactory;
            this._encoder = new CompactMessageEncoder(this._innerFactory.Encoder);
        }

        /// <summary>Get the compress message encoder</summary>
        public override MessageEncoder Encoder
        {
            get
            {
                return (MessageEncoder)this._encoder;
            }
        }

        /// <summary>Get the message version</summary>
        public override MessageVersion MessageVersion
        {
            get
            {
                return this._innerFactory.MessageVersion;
            }
        }
    }
}
